namespace Collaboris.Saf.Actions.Wss.Tests.Generated
{
    using Engine.Report;

    using Microsoft.SharePoint;
    using Microsoft.VisualStudio.TestTools.UnitTesting;
    
    using Entities;
    using Column;

    using Saf.Tests;

    using SharePoint.Wss.Columns;

    using TestHelper=Collaboris.Saf.Actions.Wss.Tests.TestHelper;

    /// <summary>
    /// This test was originally generated but has now been tested and verfiied by MJ
    /// </summary>
    [TestClass]
    public class AddSiteColumnToContentTypeTest
    {

        [TestMethod]
        public void AddSiteColumnToContentType_Test()
        {
            WSSTestAssistant<AddSiteColumnToContentType, AddSiteColumnToContentTypeInfo> addsitecolumntocontenttype =
                    new WSSTestAssistant<AddSiteColumnToContentType, AddSiteColumnToContentTypeInfo>(TestEnvironment.PublishingSite, "AddSiteColumnToContentTypeTestWeb", "BLANKINTERNET#0");

            using (addsitecolumntocontenttype)
            {
                TestHelper.CreateNewOrderContentType(addsitecolumntocontenttype.TestWeb);

                
                SiteColumnHelper.CreateNewFieldInWeb(
                    addsitecolumntocontenttype.TestWeb,
                    addsitecolumntocontenttype.FirstEntity.FieldName,
                    SPFieldType.Text,
                    false, true);

                MacroReport doReport = addsitecolumntocontenttype.DoMacro();

                SPContentType contentType = addsitecolumntocontenttype.TestWeb.ContentTypes[
                    addsitecolumntocontenttype.FirstEntity.ContentTypeName];

                Assert.IsNotNull(contentType.FieldLinks[addsitecolumntocontenttype.FirstEntity.FieldName]);

                MacroReport unDoReport = addsitecolumntocontenttype.UndoMacro();

                SPContentType contentType1 = addsitecolumntocontenttype.TestWeb.ContentTypes[
                    addsitecolumntocontenttype.FirstEntity.ContentTypeName];

                Assert.IsNull(contentType1.FieldLinks[addsitecolumntocontenttype.FirstEntity.FieldName]);

                
            }
        }

    }
}
